package com.ssh.dao.impl;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.ssh.dao.LoginDao;
import com.ssh.entity.Users;
@Repository
public class LoginDaoImpl  implements LoginDao{
	
	@Autowired
	private SessionFactory sessionFactory;
	public boolean doLogin() {
		Session session = sessionFactory.openSession();
		String sql="from Users where user_code=? and password=?";
		Query query = session.createQuery(sql);
		query.setParameter(0,"张三");
		query.setParameter(1,"1");
		Users result = (Users)query.uniqueResult();
		if(result!=null) {
			return true;
		}
		return false;
	}

}
